package exception;

import javax.swing.*;
import java.util.Scanner;

public class IsTriangle {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入三角形的三边：");
        System.out.println("a=");
        int a = sc.nextInt();
        System.out.println("b=");
        int b = sc.nextInt();
        System.out.println("c=");
        int c = sc.nextInt();
        try{
            IsTriangle.isTriangle(a,b,c);
        }catch(Exception e){
            e.printStackTrace();
        }

    }
   static void isTriangle(int a,int b,int c){
            if(a+b>c && a+c>b &&b+c>a) {
                System.out.println("a="+a+",b="+b+",c="+c+"是三角形");
            }else{
                throw new IllegalArgumentException(a+","+b+","+c+"不能构成三角形");
            }
    }
}
